package com.fanshuai.springcloud.handler;

import com.fanshuai.springcloud.domain.Book;
import com.fanshuai.springcloud.domain.User;
import com.fanshuai.springcloud.outer.bookService.BookServiceFeign;
import com.fanshuai.springcloud.outer.userservice.UserServiceFeign;
import com.fanshuai.springcloud.web.response.CallResult;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;

import javax.annotation.Resource;
import java.util.List;

@Component
public class WebFluxHandler {
    @Resource
    private BookServiceFeign bookServiceFeign;
    @Resource
    private UserServiceFeign userServiceFeign;

    public CallResult<List<Book>> books(ServerRequest serverRequest) {
        return bookServiceFeign.list();
    }

    public CallResult<List<User>> users(ServerRequest serverRequest) {
        return userServiceFeign.list();
    }
}
